//
//  EditCell.m
//  HubeiHotel
//
//  Created by LiBenCan on 17/11/22.
//  Copyright © 2017年 张露杰. All rights reserved.
//

#import "EditCell.h"
#import "TextFiledView.h"
@implementation EditCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

-(void)loadCell:(NSString *)titleStr text:(NSString *)text placeHodel:(NSString *)hodelStr
{
    for (UIView *view in self.contentView.subviews) {
        [view removeFromSuperview];
    }
    UIView *baseView = [UIView new];
    [self.contentView addSubview:baseView];
    [baseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(0*screenW_6);
        make.top.equalTo(self.contentView).offset(0*screenW_6);
        make.width.equalTo(@(SCREENW));
        make.height.equalTo(@(50*screenW_6));
        make.bottom.equalTo(self.contentView.mas_bottom).offset(0*screenW_6);
    }];
    
    //尖头
    _JianTouView = [UIImageView new];
    [self.contentView addSubview:_JianTouView];
    _JianTouView.hidden = YES;
    if ([titleStr isEqualToString:@"入职时间"] || [titleStr isEqualToString:@"离职时间"]  || [titleStr isEqualToString:@"毕业年份"]) {
        _JianTouView.image = [UIImage imageNamed:@"data"];
    }else
    {
        _JianTouView.image = [UIImage imageNamed:@"back_down"];
    }
   
    [_JianTouView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@(-20*screenW_6));
        make.height.equalTo(@(_JianTouView.image.size.height));
        make.width.equalTo(@(_JianTouView.image.size.width));
        make.top.equalTo(self.contentView).offset(25*screenW_6-_JianTouView.image.size.height/2);
    }];
    
    
    //输入框
    _textF = [[TextFiledView alloc]initWithFrame:CGRectMake(0,0, SCREENW-40*screenW_6, 49*screenW_6) PlaceHodel:hodelStr Title:titleStr text:text];
    _textF.backgroundColor = [UIColor whiteColor];
    __weak typeof(self) weakSlef = self;
    _textF.tfBlock = ^(NSString *tfStr){
        if (weakSlef.blcok) {
            weakSlef.blcok(tfStr);
        }
    };
    [baseView addSubview:_textF];
    
    //画线
    _lineLab = [UILabel new];
    _lineLab.backgroundColor = LineColor;
    _lineLab.text = @" ";
    [self.contentView  addSubview:_lineLab];
    [_lineLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(15*screenW_6));
        make.right.equalTo(@0);
        make.height.equalTo(@(1*screenW_6));
        make.top.equalTo(_textF.mas_bottom).offset(0*screenW_6);
    }];

    _lineLab.hidden = [titleStr isEqualToString:@"一句话介绍"]?YES:NO;
    _textF.lineLab.hidden = YES;
}


@end
